package com.stork.sms.fragment;



import com.stork.sms.activity.Webview;
import com.stork.sms.utilities.SharedPreference;
import com.stork.sms.R;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Fragment;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.TextView;

@SuppressLint("NewApi")
public class AddressView extends Fragment implements OnClickListener{

	public static final String COLLEGE_NAME = "collegename";
	public static final String ADDRESS = "address";
	public static final String PHONE= "phone";
	public static final String EMAIL= "email";
	public static final String WEBSITE= "website";
	TextView cname,address,phone,email,website;
	String a1,b1,c1,d1,e1;
	
	@TargetApi(Build.VERSION_CODES.HONEYCOMB)
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		
		View addView=inflater.inflate(R.layout.addressview, null);
		cname=(TextView)addView.findViewById(R.id.collegename);
		address=(TextView)addView.findViewById(R.id.address);
		phone=(TextView)addView.findViewById(R.id.phoneno);
		email=(TextView)addView.findViewById(R.id.emailid);
		website=(TextView)addView.findViewById(R.id.website);
		
		a1=SharedPreference.readString(getActivity().getApplicationContext(), COLLEGE_NAME, "");
		b1=SharedPreference.readString(getActivity().getApplicationContext(), ADDRESS, "");
		c1=SharedPreference.readString(getActivity().getApplicationContext(), PHONE, "");
		d1=SharedPreference.readString(getActivity().getApplicationContext(), EMAIL, "");
		e1=SharedPreference.readString(getActivity().getApplicationContext(), WEBSITE, "");
		
		cname.setText(a1);
		Log.d("varadha", "cname");
		address.setText(b1);
		phone.setText(c1);
		email.setText(d1);
		website.setText(e1);
		
		website.setOnClickListener(this);			
		return addView;
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
		Intent web=new Intent(getActivity(), Webview.class);
		startActivity(web);
		
	}
	
	
}
